package android.demo.activity;

import android.content.Intent;
import android.demo.BaseActivity;
import android.demo.activity.dialog.DialogActivity;
import android.demo.activity.launchmode.LaunchModeActivity;
import android.demo.activity.menu.MenuActivity;
import android.demo.activity.passvalue.FirstActivity;
import android.demo.activity.tab.TabActivity;
import android.demo.timer.TimerActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class ActivityList extends BaseActivity {
	
	private static final int PASS_VALUE = 0;
	private static final int LAUNCH_MODE = 1;
	private static final int MENU = 2;
	private static final int DIALOG = 3;
	private static final int LIST = 4;
	private static final int TAB = 5;
	private static final int TIMER = 6;
	
	public void onCreate(Bundle savedInstanceState) {  
		super.onCreate(savedInstanceState);  
		ListView lv = new ListView(this);
		ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
				android.R.layout.simple_expandable_list_item_2,  
				new String[] {"PassValue", "LaunchMode", "Menu", "Dialog", "ListView", "TAB", "Timer"});
		lv.setAdapter(adapter);
		lv.setOnItemClickListener(new OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				switch (position) {
					case PASS_VALUE :
						startActivity(new Intent(ActivityList.this, FirstActivity.class));
						break;
					case LAUNCH_MODE :
						startActivity(new Intent(ActivityList.this, LaunchModeActivity.class));
						break;
					case MENU :
						startActivity(new Intent(ActivityList.this, MenuActivity.class));
						break;
					case DIALOG :
						startActivity(new Intent(ActivityList.this, DialogActivity.class));
						break;
					case LIST :
						startActivity(new Intent(ActivityList.this, android.demo.activity.list.ListActivity.class));
						break;
					case TAB :
						startActivity(new Intent(ActivityList.this, TabActivity.class));
						break;
					case TIMER :
						startActivity(new Intent(ActivityList.this, TimerActivity.class));
						break;
				}
				
			}
		});
		setContentView(lv);
	}  
}